﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ImagesCreate.ascx.cs" Inherits="RealState.W.AdminControl.ImagesCreate" %>
<div class="grid_12">
    <div class="box">
        <h2>
            THÊM MỚI ẢNH
        </h2>
            <div style="float: right; width: 100%; text-align: right; margin-bottom: 5px;">
<%--                <asp:LinkButton ID="LinkButton1" CssClass="button medium red" runat="server" PostBackUrl="~/AdminPanel/Images.aspx"
                    CausesValidation="False">Danh sách</asp:LinkButton>
                <asp:Button ID="Button1" CssClass="button medium blue" runat="server" Text="Thêm mới"
                    OnClick="btnSave_Click" />--%>
            </div>
            <div class="box">
                <div class="block">
                    <div class="form_place">
                        <section class="form_row">
										<div class="grid_2"><label>Tiêu đê:</label></div>
										<div class="grid_10">
											<div class="block_content">
												<asp:TextBox ID="txtTitle" CssClass="validate[required] text-input" Width="500px" runat="server"></asp:TextBox>
											</asp:UpdatePanel>
											</div>
										</div>
										<div class="clear"></div>
				        </section>
                        <section class="form_row">
										<div class="grid_2"><label>Đường dẫn chi tiết:</label></div>
										<div class="grid_10">
											<div class="block_content">
												<asp:TextBox ID="txtTitleAlias" CssClass="validate[required,custom[url]] text-input" Width="500px" runat="server" AutoPostBack="True"></asp:TextBox>
											
											</div>
										</div>
										<div class="clear"></div>
				        </section>				
				        
				        <section class="form_row">
										<div class="grid_2"><label>Thuộc loại :</label></div>
										<div class="grid_10">
											<div class="block_content">
											    <asp:DropDownList ID="drpImageTypes" runat="server"></asp:DropDownList>
												
											</div>
										</div>
										<div class="clear"></div>
				        </section>
				            
                        <section class="form_row">
										<div class="grid_2"><label>Ảnh :</label></div>
										<div class="grid_10">
											<div class="block_content">
											    <asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" style="display:none"></asp:Button>
											    <asp:Button ID="btnBindImagesThum" runat="server" Text="Button" style="display:none" onclick="btnBindImagesThum_Click"  />
                                                <asp:HiddenField ID="hdImages" runat="server" />
                                                <script language="javascript" type="text/javascript">
                                                     //var src = "../upload/Logo/" ;

                                                    $(function() {
                                                        $('#<%=drpImageTypes.ClientID %>').change(function() {
                                                            var imgty = $(this).val();
                                                            $('#<%=hdImages.ClientID %>').val(imgty);
                                                            var buttonToClick1 = '<%=Button2.UniqueID %>';
                                                            __doPostBack(buttonToClick1, "");

                                                        });

                                                        $('#<%=ddlThumbnail.ClientID %>').change(function() {
                                                            var src;
                                                            var width;
                                                            var imgSrc = $(this).val();
                                                            tmp = $('#<%=drpImageTypes.ClientID %>').val();
                                                            if (tmp == "1") { src = "../upload/Logo/"; width = 238; }
                                                            else if (tmp == "2") { src = "../upload/Banners/"; width = 600; }
                                                            else if (tmp == "3") { src = "../upload/Ad/"; width = 300; }
                                                            else if (tmp == "4") { src = "../upload/Partner/"; width = 164; }
                                                            $('#upload-thumbnail-form').attr("src", "plugins/UploadImage.aspx?sessionValue=thumb&desiredwidth=" + width + "&t="+tmp);
                                                            $("#article_img_thumbnail").attr("src", src + imgSrc);
                                                            $("#article_img_thumbnail").css("display", "inline");

                                                            $("#article_img_thumbnail_modal").attr("title", imgSrc);
                                                            $("#article_img_thumbnail_modal").attr("src", src + imgSrc);

                                                        });

                                                        $(function() {

                                                            $('#<%=ddlThumbnail.ClientID %>').change();


                                                            $('#article_img_thumbnail_modal').dialog({ autoOpen: false, resizable: false, draggable: false, modal: true, width: 267, height: 200, title: "Thumbnail" });


                                                            $('#article_img_thumbnail').click(function() {

                                                                $('#article_img_thumbnail_modal').dialog("open");
                                                            });

                                                        });

                                                    });


                                        </script>

                                                 <script language="javascript" type="text/javascript">
                                          function bindImagesThum() {

                                              var buttonToClick = '<%=btnBindImagesThum.UniqueID %>';

                                                __doPostBack(buttonToClick, "");

                                            }
                                        </script>

                                        <iframe  width="99%" style="height:120px; display:none" frameborder="0" id="upload-thumbnail-form">
                                        </iframe>


											<table border="0" cellpadding="0" cellspacing="0" class="notable">
                                                <tr>
                                                <td  valign="top" style="vertical-align:top">
                                                    <asp:DropDownList ID="ddlThumbnail" runat="server" CssClass="textbox" Width="250" style="margin-top: 15px;"></asp:DropDownList>        
                                                </td>
                                                <td style="padding-left:10px; vertical-align:top" valign="top">
                                                    <img style="display:none" id="article_img_thumbnail_modal" alt="" />
                                                    <img style="display:none; height:40px; cursor:pointer; border-radius:5px;" id="article_img_thumbnail" alt="" height="40px" title="Click to view image in full size" />
                                                </td>
                                                <td style="padding-left:10px; vertical-align:middle" valign="middle">

                                                <a href="#" onclick="$('#upload-thumbnail-form').dialog('destroy'); $('#upload-thumbnail-form').dialog({resizable: false, draggable: false, modal: true, width: 380, height: 250, title: 'Upload thumbnail' }).width(380).height(250); return false;"><img src="images/upload.png" alt="" title="Upload" /></a>


                                                </td>
                                                </tr>
                                                </table>
											</div>
										</div>
										<div class="clear"></div>
									</section>
									
                            <section class="form_row">
										<div class="grid_2"><label>Sắp xếp:</label></div>
										<div class="grid_10">
											<div class="block_content">
												<asp:TextBox ID="txtQuantity" CssClass="validate[required,custom[onlyNumberSp]] text-input" Width="120px" runat="server" ></asp:TextBox>
											</div>
										</div>
										<div class="clear"></div>
				             </section>
				             
                            <section class="form_row">
										<div class="grid_10">
										<asp:CheckBox ID="cbkActice" runat="server" Text="Hiển thị"></asp:CheckBox>
										</div>
										
										<div class="clear"></div>
				            </section>
                        <section class="form_row">
					<div class="grid_10_1 alignright">
						<div class="block_content">
                          <asp:Button ID="btnSave" CssClass="button medium blue" Width="90px" runat="server"
                                Text="Thêm mới" OnClick="btnSave_Click" />
						</div>
					</div>
					</section>
                    </div>
                </div>
            </div>
    </div>
</div>
